package com.xuchaotong.concurrent;

public class MobileRunable implements Runnable{
    private volatile boolean isRunning = true;

    @Override
    public void run() {
        System.out.println("the mobile start run!");
        while (isRunning){
//            System.out.println("the mobile is running!" + isRunning);
//            try {
//                Thread.sleep(1000);
//            } catch (InterruptedException e) {
//                e.printStackTrace();
//            }
        }

        try {
            System.out.println(Thread.interrupted());
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        System.out.println("the mobile stop run!");

    }

    public boolean isRunning() {
        return isRunning;
    }

    public void setRunning(boolean running) {
        isRunning = running;
    }
}
